﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using VerkeersComponentenLibrary;

namespace TrafficControlProto1
{
    public partial class Form1 : Form
    {
        TFormKruispunten frm;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frm = new TFormKruispunten();
            frm.Show();
            frm.Size = new System.Drawing.Size(630, 630);
            ZKruispunt tkr1 = new ZKruispunt();
            tkr1.Wegdek.WegOnder.WegType = TWegType.swDrieBaansL;
            TStoplicht tsl1 = new TStoplicht();
            tsl1.AantalLampen = 3;
            tsl1.WaarzitRood = TPositie.srBoven;
            tsl1.Kleur = TStoplichtKleur.skGeelKnipper;
            tsl1.SetBounds(80, 60, 20, 40);
            tkr1.addStoplicht(tsl1);
            TAuto auto = new TAuto();
            auto.SetBounds(110, 10, 10, 10);
            auto.Kleur = Color.Red;
            tkr1.addAuto(auto);
            frm.insertKruispunt(1, tkr1, 0, 0, 300, 300);
            frm.insertKruispunt(2, new ZKruispunt(), 300, 0, 300, 300);
            frm.Refresh();

            timer1.Interval = 50;
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
           // UpdateVoetgangers();
            TKruispunt kp = frm.getKruispuntAt(1);
            TAuto a = kp.getAuto(0);
            a.SetBounds(a.Location.X, a.Location.Y + 1, 10, 10);
        }
    }
}
